package com.johnson.news.model.remote;

import com.johnson.news.model.bean.AskMeNotice;
import com.johnson.news.model.bean.AskmeData;
import com.johnson.news.model.bean.BaseResponseData;
import com.johnson.news.model.bean.ContactItem;
import com.johnson.news.model.bean.ContinueView;
import com.johnson.news.model.bean.DataNewsCategory;
import com.johnson.news.model.bean.DataUserInfo;
import com.johnson.news.model.bean.DataWeiXinItem;
import com.johnson.news.model.bean.LaunchPic;
import com.johnson.news.model.bean.NewsContent;
import com.johnson.news.model.bean.NewsItem;
import com.johnson.news.model.bean.NewsReplyItem;
import com.johnson.news.model.bean.ReplyItem;
import com.johnson.news.model.bean.SearchResult;
import com.johnson.news.model.bean.UpdateItem;
import com.johnson.news.model.bean.WeiboItem;

import java.util.ArrayList;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;

import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;


public interface APIService {
    String baseUrl = "http://jyt.shaanxi.gov.cn/mob/";

    @GET("app.php")
    Observable<LaunchPic> getSplashInfo();

    @GET("appindex.php")
    Observable<ArrayList<NewsItem>> getTopicNews(@Query("mid") String mid, @Query("istop") int istop, @Query("pagesizes") int pagesizes, @Query("page") int page);

    @GET("appchannel.php")
    Observable<ArrayList<DataNewsCategory>> getNewsCats();

    @GET("appindex.php")//mid=31&istop=1&pagesizes=1&page=1
    Observable<ArrayList<NewsItem>> getNewsList(@Query("mid") String mid, @Query("catid") int catid, @Query("istop") int istop, @Query("pagesizes") int pagesizes, @Query("page") int page);

    @GET("appcontent.php")
    Observable<NewsContent> getNewsDetail(@Query("mid") String mid, @Query("catid") String catid, @Query("itemid") String itemid);

    @GET("appcontentlist.php")
    Observable<ArrayList<NewsItem>> getNewsRelatedList(@Query("mid") String mid, @Query("catid") String catid, @Query("pagesizes") int pagesizes, @Query("page") int page);

    @GET("appcontentpllist.php")
    Observable<ArrayList<NewsReplyItem>> getNewsReplies(@Query("mid") String mid, @Query("itemid") String itemid, @Query("pagesizes") int pagesizes, @Query("page") int page);

    @GET("appcontentpl.php")
    Observable<BaseResponseData> newsComment(@Query("mid") String mid, @Query("itemid") String itemid, @Query("content") String content, @Query("ip") String ip);

    @FormUrlEncoded
    @POST("appzan.php")
    Observable<BaseResponseData> newsLike(@Field("itemid") String itemid, @Field("username") String username);

    @GET("appweibo.php")
    Observable<ArrayList<WeiboItem>> getWeiboList();

    @GET("applxwm.php")
    Observable<ContactItem> getContactUsItem();

    //会员注册获取短信验证码接口
    @FormUrlEncoded
    @POST("appsms.php")
    Observable<BaseResponseData> getVerifyCodeOfRegister(@Field("mob") String mob);

    @FormUrlEncoded
    @POST("appreg.php")
    Observable<DataUserInfo> register(@Field("mob") String mob, @Field("yzm") String yzm, @Field("password") String password, @Field("channelid") String channelid, @Field("system") String system);

    @FormUrlEncoded
    @POST("applogin.php")
    Observable<DataUserInfo> login(@Field("mob") String mob, @Field("password") String password, @Field("channelid") String channelid, @Field("system") String system);

    @FormUrlEncoded
    @POST("appmodifypwd.php")
    Observable<DataUserInfo> modifyPwd(@Field("mob") String mob, @Field("token") String token, @Field("password") String password);

    @FormUrlEncoded
    @POST("appgetpwdsms.php")
    Observable<BaseResponseData> getVerifyCodeOfFindPwd(@Field("mob") String mob);

    @FormUrlEncoded
    @POST("appgetpwd.php")
    Observable<DataUserInfo> findPwd(@Field("mob") String mob, @Field("yzm") String yzm, @Field("password") String password);

    @FormUrlEncoded
    @POST("appupgrade.php")
    Observable<UpdateItem> checkUpdate(@Field("code") int code, @Field("apptype") int apptype);

    @FormUrlEncoded
    @POST("appwwblist.php")
    Observable<AskmeData> getMyComplaint(@Field("token") String token, @Field("types") int types, @Query("pagesizes") int pagesizes, @Query("page") int page);

    @FormUrlEncoded
    @POST("appwwbwdafu.php")
    Observable<ReplyItem> getComplaintDetail(@Field("token") String token, @Field("itemid") int itemid);

    @FormUrlEncoded
    @POST("appwwblyxz.php")
    Observable<AskMeNotice> getComplaintNotice(@Field("noParams") int noParams);

    @FormUrlEncoded
    @POST("appwwbwyzx.php")
    Observable<BaseResponseData> postComplaint(@Field("token") String token, @Field("title") String title,
                                               @Field("content") String content, @Field("name") String name,
                                               @Field("email") String email, @Field("mob") String mob,
                                               @Field("ip") String ip);//@Field("address") String address, @Field("zhiye") String zhiye,

    @GET()//"appsearch.php"
    Observable<ArrayList<NewsItem>> search(@Url String url);//, @Query("mid") String mid, @Query("kw") String kw, @Query("pagesizes") int pagesizes, @Query("page") int page

    @GET("appweixin.php")
    Observable<DataWeiXinItem> getOfficalWeiXin();

//    @FormUrlEncoded
//    @POST("authorize")
//    Observable<BaseDataWithBean<DataAuthorize>> oauth2(@FieldMap HashMap<String, String> hashmap);

}
